<?php
Class C_region extends Cemvc_Control_Base
{
  /* insert a user record into users table */
  public function get_cities()
  {
    if (!isset($_REQUEST["province_code"]) || empty($_REQUEST["province_code"]))
      die(json_encode(array("resp_id"=>"0001", "resp_str"=>"You must specified a province code.")));

    //include_once "QinRegion.class.php";
    $region = new M_qin_region();
    $provinces = $region->getCitiesList($_REQUEST["province_code"]);
    
    echo json_encode($provinces);
  }
  public function get_towns()
  {
    if (!isset($_REQUEST["city_code"]) || empty($_REQUEST["city_code"]))
      die(json_encode(array("resp_id"=>"0001", "resp_str"=>"You must specified a city code.")));

    //include_once "QinRegion.class.php";
    //$region = new QinRegion();
    $region = new M_qin_region();
    $city_list = $region->getTownsList($_REQUEST["city_code"]);
    
    echo json_encode($city_list);
  }
}
